package org.rsbot.event.events;

import java.util.EventListener;
import org.rsbot.event.listeners.CharacterMovedListener;
import org.rsbot.script.methods.MethodContext;

public class CharacterMovedEvent extends RSEvent
{
  private static final long serialVersionUID = 8883312847545757405L;
  private final MethodContext ctx;
  private final org.rsbot.client.RSCharacter character;
  private final int direction;
  private org.rsbot.script.wrappers.RSCharacter wrapped;

  public CharacterMovedEvent(MethodContext paramMethodContext, org.rsbot.client.RSCharacter paramRSCharacter, int paramInt)
  {
    this.ctx = paramMethodContext;
    this.character = paramRSCharacter;
    this.direction = paramInt;
  }

  public void dispatch(EventListener paramEventListener)
  {
    ((CharacterMovedListener)paramEventListener).characterMoved(this);
  }

  public org.rsbot.script.wrappers.RSCharacter getCharacter() {
    if (this.wrapped == null)
    {
      Object localObject;
      if ((this.character instanceof org.rsbot.client.RSNPC)) {
        localObject = (org.rsbot.client.RSNPC)this.character;
        this.wrapped = new org.rsbot.script.wrappers.RSNPC(this.ctx, (org.rsbot.client.RSNPC)localObject);
      } else if ((this.character instanceof org.rsbot.client.RSPlayer)) {
        localObject = (org.rsbot.client.RSPlayer)this.character;
        this.wrapped = new org.rsbot.script.wrappers.RSPlayer(this.ctx, (org.rsbot.client.RSPlayer)localObject);
      }
    }
    return (org.rsbot.script.wrappers.RSCharacter)this.wrapped;
  }

  public int getDirection()
  {
    return this.direction;
  }

  public long getMask()
  {
    return 1024L;
  }
}